package com.sky.utils;

import org.springframework.beans.BeanUtils;

import java.lang.reflect.Constructor;

public class BeanUtilPro {

    public  static<T> T getBeanByCopy(Object object, Class<T> className){
        try {
            Constructor<?> constructor = className.getConstructor(null);
            T o = (T)constructor.newInstance(null);

            BeanUtils.copyProperties(object, o);
            return o;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }


    }
}
